#ifndef STATUS_H
#define STATUS_H

#include "annotationimage.h"
#include "imageannitem.h"
#include "utility.h"
#include "imageannotation.h"
#include "imageannentry.h"
#include <QString>
#include <QDir>
#include <QCoreApplication>
#include <QStringList>

// 状态类为软件的数据管理类，处理控制软件运行的相关数据、状态等
class Status
{
public:
    // 更新状态
    void updateStatus();
    // 创建状态
    void createStatus(const string &directory);

    /*-----------------getter------------------*/

    Type getNowSelection() const
    {
        return nowSelection;
    }
    const string& getImageDir() const
    {
        return imageDir;
    }
    const vector<string>& getImageFiles() const
    {
        return imageFiles;
    }

    int getNowImageIndex() const
    {
        return nowImageIndex;
    }
    int getImageCounts() const
    {
        return imageCounts;
    }
    const ImageAnnotation& getNowImageAnn() const
    {
        return nowImageAnn;
    }
    ImageAnnotation& getNowImageAnn()  //非const版本
    {
        return nowImageAnn;
    }
    const AnnotationImage& getNowAnnImage() const
    {
        return nowAnnImage;
    }
    AnnotationImage& getNowAnnImage()
    {
        return nowAnnImage;
    }

    int getIndex()
    {
        return index;
    }

    /*-----------------setter------------------*/

    void setNowSelection(const Type nowSelection)
    {
        this->nowSelection = nowSelection;
    }
    void setImageDir(const string &imageDir)
    {
        this->imageDir = imageDir;
    }
    void setImageFiles(const vector<string> &imageFiles)
    {
        this->imageFiles = imageFiles;
    }
    void setNowImageIndex(int imageIndex)
    {
        this->nowImageIndex = imageIndex;
    }
    void setImageCounts(int imageCounts)
    {
        this->imageCounts = imageCounts;
    }
    void setNowImageAnn(const ImageAnnotation &imageAnn)
    {
        this->nowImageAnn = imageAnn;
    }
    void setNowAnnImage(const AnnotationImage &annImage)
    {
        this->nowAnnImage = annImage;
    }
    void setIndex(int _index)
    {
        index = _index;
    }


private:
    // 当前操作选项
    Type nowSelection;

    // 标注图像文件所在目录
    string imageDir;

    // 标注文件名称数组
    vector<string> imageFiles;

    // 当前标注图像在图像列表中的索引
    int nowImageIndex;

    // 标注图像文件数量
    int imageCounts;

    // 当前图像文件标注
    ImageAnnotation nowImageAnn;

    // 当前正标注的图像
    AnnotationImage nowAnnImage;

    // 当前条目在所有条目中的索引
    int index;
};

// 给定目录，将所有图片文件存入files中
void getFiles(string directoryPath, vector<string>& files);

#endif // STATUS_H
